<?php

    include("header.php");

    setTabIndex(2);

    createPage("Liga - Zilveren Toren");

?>



<table height="100%" cellSpacing="0" cellPadding="0" width="100%"

	border="0" bgcolor="#FFFFFF">



	<tr>

		<td id="leftFiller" valign="top" height="100%" rowspan="3"

			bgcolor="#666666">

		<table border="0" cellpadding="0" cellspacing="0" height="100%"

			width="8px">

			<tr>

				<td>&nbsp;</td>

			</tr>

		</table>

		</td>

		<td id="header" valign="top" width="100%">

		<table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#666666" width="40%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#666666" align="right" valign="top">&nbsp;
                          <span class="headerSmall">Huidige versie PLAYER.DBF: <?=CURRENT_PLAYER_DBF?>
                        <?php
                        if (isset($user) && $user->club_id == 100) {
                        ?>
                        <br/>
                        <a class="headerSmall" href="import_player.php">laad andere versie</a>
                        <?php
                        }
                        ?>
                        </span>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?> 
                </tr>

			<tr>

				<td colspan="2" nowrap bgcolor="#BCDD10" height="4"><img

					src="../../assets/images/spacer.gif" alt="" height="1" width="1"></td>

			</tr>

			<tr>

				<td>&nbsp;</td>

				<td valign="top">

				<table align="left" cellspacing="10" width="100%">

					<tr>

						<td><span class="blackHeaderLarge">Zilveren Toren <?=CURRENT_ZT_YEAR?>

						- Inschrijvingen</span>

						<br/>Hieronder vindt u het overzicht van alle inschrijvingen, met het aantal ploegen per reeks vermeld

						naast de naam van de club. <strong>Opgelet, dit is indicatieve informatie, deze kan wijzigen bij de publicatie

						van de kalender overeenkomstig de reglementen.</strong>

						</td>

					</tr>

					<tr>

						<td>

						<table width="100%" align="center" cellspacing="0" cellpadding="0"

							class="yellowBox">

							<tr>

								<td colspan="3" align="center"><strong>Reeks 1</strong></td>

								<td colspan="3" align="center"><strong>Reeks 2</strong></td>

								<td colspan="3" align="center"><strong>Reeks 3</strong></td>

							</tr>

							<?php

							mysql_connect(DB_SERVER, DB_USER, DB_PWD);

	                        mysql_select_db(DB_CATALOG);

	                        

	                        $query = "select c.club_id, c.clubname, s.dep1Count 

	                        from zt_subscription s join club c

	                        on c.club_id = s.club_id join zt_tournament t

	                        on t.tournament_id = s.tournament_id

	                        where t.isCurrent = 1 and s.dep1Count > 0

	                        order by c.club_id";

	                        $result = mysql_query($query);

	                        $dep1Subscriptions = array();

	                        while ($row = mysql_fetch_assoc($result)) {

	                            $subscription = new ZTSubscription;

	                            $subscription->clubId = $row['club_id'];

	                            $subscription->clubName = $row['clubname'];

	                            $subscription->group = '1';

	                            $subscription->groupCount = $row['dep1Count'];

	                            array_push($dep1Subscriptions, $subscription);

	                        }

	                        

	                        $maxListSize = count($dep1Subscriptions);

	                        

	                        $query = "select c.club_id, c.clubname, s.dep2Count 

	                        from zt_subscription s join club c

	                        on c.club_id = s.club_id join zt_tournament t

	                        on t.tournament_id = s.tournament_id

	                        where t.isCurrent = 1 and s.dep2Count > 0

	                        order by c.club_id";

	                        $result = mysql_query($query);

	                        $dep2Subscriptions = array();

	                        while ($row = mysql_fetch_assoc($result)) {

	                            $subscription = new ZTSubscription;

	                            $subscription->clubId = $row['club_id'];

	                            $subscription->clubName = $row['clubname'];

	                            $subscription->group = '1';

	                            $subscription->groupCount = $row['dep2Count'];

	                            array_push($dep2Subscriptions, $subscription);

	                        }

	                        

							if ( count($dep2Subscriptions) > $maxListSize ) {

								$maxListSize = count($dep2Subscriptions);

							}

	                        

	                        $query = "select c.club_id, c.clubname, s.dep3Count 

	                        from zt_subscription s join club c

	                        on c.club_id = s.club_id join zt_tournament t

	                        on t.tournament_id = s.tournament_id

	                        where t.isCurrent = 1 and s.dep3Count > 0

	                        order by c.club_id";

	                        $result = mysql_query($query);

	                        $dep3Subscriptions = array();

	                        while ($row = mysql_fetch_assoc($result)) {

	                            $subscription = new ZTSubscription;

	                            $subscription->clubId = $row['club_id'];

	                            $subscription->clubName = $row['clubname'];

	                            $subscription->group = '1';

	                            $subscription->groupCount = $row['dep3Count'];

	                            array_push($dep3Subscriptions, $subscription);

	                        }

	                        

							if ( count($dep3Subscriptions) > $maxListSize ) {

								$maxListSize = count($dep3Subscriptions);

							}

	                        

							for ($i = 0; $i < $maxListSize; $i++) {

								$team1 = new ZTSubscription;

								$team2 = new ZTSubscription;

								$team3 = new ZTSubscription;

                                                	

								if (count($dep1Subscriptions) >= $i + 1) {

	                            	$team1 = $dep1Subscriptions[$i];

								}

								

	                            if (count($dep2Subscriptions) >= $i + 1) {

	                            	$team2 = $dep2Subscriptions[$i];

	                            }

	

	                            if (count($dep3Subscriptions) >= $i + 1) {

	                            	$team3 = $dep3Subscriptions[$i];

	                            }

	                        

	                        ?>

	                        <tr>

	                        	<td width="5%" align="center" valign="top"><?=$team1->clubId?></td>

	                        	<td valign="top"><?=$team1->clubName?></td>

                                <td width="5%" align="center" valign="top" style="border-right:1px solid #A6C218;">&nbsp;<?=$team1->groupCount?></td>

                                <td width="5%" align="center" valign="top"><?=$team2->clubId?></td>

	                        	<td><?=$team2->clubName?></td>

                                <td width="5%" align="center" valign="top" style="border-right:1px solid #A6C218;">&nbsp;<?=$team2->groupCount?></td>

                                <td width="5%" align="center" valign="top"><?=$team3->clubId?></td>

	                        	<td><?=$team3->clubName?></td>

                                <td width="5%" align="center" valign="top"><?=$team3->groupCount?></td>

                            </tr>

	                        <?php

	                        }

							?>

						</table>

						</td>

					</tr>

				</table>

				</td>

			</tr>

		</table>

		</td>

	</tr>

</table>





<?php include("footer.php"); ?>